package com.sinsz.c.properties;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 监控配置
 * @author chenjianbo
 * @date 2017/11/14
 */
@ConfigurationProperties(prefix = "spring.druid")
public class DruidConsoleProperties {

    private String loginUsername;
    private String loginPassword;
    private String allow;
    private String deny;
    private boolean resetEnable;
    private String mybatisConfig;
    private String mybatisMapperPackage;

    public String getLoginUsername() {
        return loginUsername;
    }

    public void setLoginUsername(String loginUsername) {
        this.loginUsername = loginUsername;
    }

    public String getLoginPassword() {
        return loginPassword;
    }

    public void setLoginPassword(String loginPassword) {
        this.loginPassword = loginPassword;
    }

    public String getAllow() {
        return allow;
    }

    public void setAllow(String allow) {
        this.allow = allow;
    }

    public String getDeny() {
        return deny;
    }

    public void setDeny(String deny) {
        this.deny = deny;
    }

    public boolean isResetEnable() {
        return resetEnable;
    }

    public void setResetEnable(boolean resetEnable) {
        this.resetEnable = resetEnable;
    }

    public String getMybatisConfig() {
        return mybatisConfig;
    }

    public void setMybatisConfig(String mybatisConfig) {
        this.mybatisConfig = mybatisConfig;
    }

    public String getMybatisMapperPackage() {
        return mybatisMapperPackage;
    }

    public void setMybatisMapperPackage(String mybatisMapperPackage) {
        this.mybatisMapperPackage = mybatisMapperPackage;
    }

    @Override
    public String toString() {
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace(System.out);
        }
        return super.toString();
    }

}